﻿package net.fishbowlmedia.scroller3d.model 
{
	
	import net.fishbowlmedia.scroller3d.model.CoverModel;
	
	import org.papervision3d.materials.MovieMaterial;
	import org.papervision3d.objects.primitives.Plane;
	
	import flash.display.MovieClip;
	
	/**
	* ...
	* @author Tom Lauck
	*/
	
	public class MoviePlaneModel extends CoverModel
	{		
		
		private var _planeId:int;
		private var _cover:CoverModel;
		private var _plane:Plane;
		private var _planeWidth:int;
		private var _planeHeight:int;
		private var _offset:int;
		private var _seperation:int;
		private var _movieMaterial:MovieMaterial;
		private var _targetMovie:MovieClip;
		
		public function MoviePlaneModel() 
		{
		}
		public function init():void
		{
			cover = new CoverModel();	
			cover.coverId = planeId;
			cover.coverWidth = planeWidth;
			cover.coverHeight = planeHeight;
			cover.contents = targetMovie;
			
			_movieMaterial = new MovieMaterial(targetMovie, true, false, true);
			_movieMaterial.smooth = true;
			_movieMaterial.interactive = true;
			
			plane = new Plane(movieMaterial, planeWidth, planeHeight, 1, 1);
			plane.id = planeId;
		}
		public function get planeId():int { return _planeId; }
		
		public function set planeId(value:int):void 
		{
			_planeId = value;
		}
		
		public function get cover():CoverModel { return _cover; }
		
		public function set cover(value:CoverModel):void 
		{
			_cover = value;
		}
		
		public function get plane():Plane { return _plane; }
		
		public function set plane(value:Plane):void 
		{
			_plane = value;
		}
		
		public function get movieMaterial():MovieMaterial { return _movieMaterial; }
		
		
		public function get targetMovie():MovieClip { return _targetMovie; }
		
		public function set targetMovie(value:MovieClip):void 
		{
			_targetMovie = value;
		}
		
		public function get planeWidth():int { return _planeWidth; }
		
		public function set planeWidth(value:int):void 
		{
			_planeWidth = value;
		}
		
		
		public function get seperation():int { return _seperation; }
		
		public function set seperation(value:int):void 
		{
			_seperation = value;
		}
		
		public function get offset():int { return _offset; }
		
		public function set offset(value:int):void 
		{
			_offset = value;
		}
		
		public function get planeHeight():int { return _planeHeight; }
		
		public function set planeHeight(value:int):void 
		{
			_planeHeight = value;
		}
	}
	
}